import { createMemoryHistory, createRouter, createWebHashHistory } from 'vue-router'

import HomeView from '../components/HelloWorld.vue'
import LoginView from '../components/Login.vue'
import RegisterView from '../components/Register.vue'
import PasswordChanger from '../components/PasswordChanger.vue'
import component from 'element-plus/es/components/tree-select/src/tree-select-option.mjs'

const routes = [
  { path: '/', redirect: '/login'},
  {
    path: '/register',
    component: RegisterView
  },
  {
    path: '/login',
    component: LoginView
  },
  {
    path: '/corrector',
    component: PasswordChanger,
  },
  {
    path: '/home',
    component: HomeView,
    children: [
      {
        path: 'index',
        component: () => import('../components/Index.vue')
      },
      {
        path: 'user-control',
        component: () => import('../components/UserController.vue')
      },
      {
        path: 'file-control'
      },
      {
        path: '',
        redirect: '/home/index'
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

export default router